<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/9/6
 * Time: 11:51
 */

Request::get('name','','htmlspecialchars'); // 获取get变量 并用htmlspecialchars函数过滤
Request::param('username','','strip_tags'); // 获取param变量 并用strip_tags函数过滤
Request::post('name','','org\Filter::safeHtml'); // 获取post变量 并用org\Filter类的safeHtml方法过滤


Request::get('id/d');
Request::post('name/s');
Request::post('ids/a');


$res =  (new SysMoney())->save(['withdraw'=>['inc',100],'id'=>100],['id'=>100]);
$res =  (new SysMoney())->save(['withdraw'=>['dec',100],'id'=>100],['id'=>100]);

$res1 = SysMoney::quickGet(100);

//修改模型后需要 及时清除redis数据 模型方法
self::clearTable();



/*public static function addData($post) {
    self::startTrans();
    try {
        self::create($post);
        self::commit();
    } catch (\Exception $e) {
        self::rollback();
        return __error($e->getMessage());
    }
    return __success('添加成功');
}*/


$this->model->startTrans();
try {

    if(empty($main) || $main['status'] == 1  || ($main[''] < $post['number']) ) throw new \Exception('平台资金异常！');


     $this->model->commit();       // 提交事务
} catch (\Exception $e) {
    $this->model->rollback();
    return __error($e->getMessage());
}